<%--
  Created by IntelliJ IDEA.
  User: WS
  Date: 2020/3/16
  Time: 10:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>隐式对象的使用</title>
</head>
<body>
<h2>request对象的使用</h2>
    <%
    String remoteAddr = request.getRemoteAddr();
    String remoteHost = request.getRemoteHost();
    int serverPort = request.getServerPort();
%>
你的IP地址为：<%=remoteAddr %><br>
你的主机名为：<%=remoteHost %><br>
服务器的端口号为：<%=serverPort %><br>
<h2>out对象的使用</h2>
    <%
    out.print("学习使用out对象");
    int buffer = out.getBufferSize();
    int available = out.getRemaining();
%>
<br>
out对象的类型为：<%= out.getClass().getName() %><br>
BufferSize=<%= buffer %><br>
Available=<%= available %>
<h2>application对象的使用</h2>
    <%
  int number = 0;
  Integer num =(Integer)application.getAttribute("num");
  if(num==null){
    application.setAttribute("num",new Integer(number));
  }
  else{
    number = num.intValue()+1;
    application.setAttribute("num",new Integer(number));
  }
 %>
<html>
<head><title>application example</title></head>
<body>
<center><font color="#0000ff" size="5">application对象示例</font>
</center>
<hr>
本页面文件的实际路径是：<br><%=application.getRealPath("application.jsp") %><br>
application对象中变量num的值为：<%=application.getAttribute("num") %>
<h2>session对象的使用</h2>
    <%
  session.setAttribute("user","欧阳清风");
%>

<html>
<body>
您的会话ID是：<%=session.getId()%><br>
session对象中存放的变量user的值为：<%=session.getAttribute("user")%>

</body>
</html>
